package com.fesine.quartz.chapter7;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobExecutionContext;
import org.quartz.Trigger;
import org.quartz.TriggerListener;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2016/11/19 21:09
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/11/19 21:09
 */
public class SimpleTriggerListener implements TriggerListener {
    static Log logger = LogFactory.getLog(SimpleTriggerListener.class);

    public String getName() {
        return getClass().getSimpleName();
    }

    @Override
    public void triggerFired(Trigger trigger, JobExecutionContext context) {
        String triggerName = trigger.getName();
        logger.info(triggerName + " was fired");
    }

    @Override
    public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) {
        String triggerName = trigger.getName();
        logger.info(triggerName + " was not vetoed");
        return false;
    }

    @Override
    public void triggerMisfired(Trigger trigger) {
        String triggerName = trigger.getName();
        logger.info(triggerName + " misfired");
    }

    @Override
    public void triggerComplete(Trigger trigger, JobExecutionContext context, int
            triggerInstructionCode) {
        String triggerName = trigger.getName();
        logger.info(triggerName + " is complete");
    }
}
